<div class="row">
    <div class="col-lg-12">
        <h3 class="page-header"><i class="fa fa-users"></i> 系统用户</h3>
        <ol class="breadcrumb">
            <li><i class="fa fa-cogs"></i><a href="index.html">系统设置</a></li>
            <li><i class="fa fa-users"></i>系统用户</li>
        </ol>
    </div>
</div>
<div class="row">
    <div class="col-lg-12">
        <section class="panel">
            <header class="panel-heading">
                编辑用户
            </header>
            <div class="panel-body">
                <form class="form-horizontal " method="post" action="index.php?r=user/savedata" >
                    <input type="hidden" name="user_id" value="<?php echo $user['user_id']; ?>">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">登入名</label>
                        <div class="col-sm-10">
                            <input type="text" name="username" value="<?php echo $user['username']; ?>"  class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">姓名</label>
                        <div class="col-sm-10">
                            <input type="text" name="realname" value="<?php echo $user['realname']; ?>" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">角色</label>
                        <div class="col-sm-10">
                            <?php
                            foreach ($roles as $role){
                                ?>
                                <label class="checkbox-inline">
                                    <input type="checkbox" name="roles[]" value="<?php echo $role['name']; ?>"
                                        <?php
                                        if(array_key_exists($role['name'],$userrolesarray)){
                                            ?>
                                            checked="checked"
                                            <?php
                                        }
                                        ?>
                                    > <?php echo $role['name']; ?>
                                </label>
                                <?php
                            }
                            ?>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-10">
                            <button type="submit" class="btn btn-primary">保存</button>
                        </div>
                    </div>
                </form>
            </div>
        </section>
    </div>
</div>
<script>
    $(function () {
        $("#menu_sysconfig").addClass("active");
        $("#menu_sysconfig .menu-arrow").removeClass("arrow_carrot-right").addClass("arrow_carrot-down");
        $("#item_sysconfig_role_module").parent("li").addClass("active");
    });
</script>